package com.stupid.eureka.client.order.controllers;

import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@Slf4j
public class OrderController {

    @RequestMapping(value = "/createOrder", method = RequestMethod.POST)
    public ResponseEntity<String> createOrder(@RequestBody Map<String, String> order) throws InterruptedException {
        log.info("begin to create order");
        log.info("order : {}", order.toString());
        Thread.sleep(3000);
        log.info("complete to create order");
        return new ResponseEntity<>("create order successfully", HttpStatus.OK);
    }
}
